﻿<UserControl x:Class="TechNewLogic.GraphIT.ContextMenuControl"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d"
		d:DesignHeight="300" d:DesignWidth="300" x:Name="root" x:ClassModifier="internal">

	<ComboBox x:Name="comboBox" Focusable="False">
		<ComboBox.Template>
			<ControlTemplate TargetType="ComboBox">
				<!-- HACK: Wenn lediglich das Popup im ControlTemplate ist, so kann z.B. ein Button im menuContentPanel nicht grdrückt werden (das Popup geht beim Drücken sofort zu). -->
				<ContentControl>
					<Popup Placement="MousePoint" IsOpen="{TemplateBinding IsDropDownOpen}"
							AllowsTransparency="True">
						<Border BorderThickness="1"
								BorderBrush="{DynamicResource GeneralForeground}"
								Background="{DynamicResource GeneralBackground}">
							<!--<StackPanel x:Name="menuContentPanel" Margin="10" />-->
							<ItemsControl ItemsSource="{Binding MenuEntries, ElementName=root}"
									Margin="10">
								<ItemsControl.ItemTemplate>
									<DataTemplate>
										<ContentControl Content="{Binding Visual}" Margin="0,2" />
									</DataTemplate>
								</ItemsControl.ItemTemplate>
							</ItemsControl>
						</Border>
					</Popup>
				</ContentControl>
			</ControlTemplate>
		</ComboBox.Template>
	</ComboBox>

</UserControl>
